﻿cmake_minimum_required(VERSION 3.16)

project(CameraCommon VERSION 2.0.0 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets LinguistTools Multimedia)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets LinguistTools Multimedia)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/..)

add_library(CameraCommon SHARED
    ../Camera_global.h
    IndustryCamera.h
    IndustryCameraInfo.h
    DialogCameraSelect.cpp
    DialogCameraSelect.h
    DialogCameraSelect.ui
    DialogCameraSetup.h
    DialogCameraSetup.cpp
    DialogCameraSetup.ui
    CameraImage.cpp
    CameraImage.h
    CameraImage_RGB24.cpp
    CameraImage_RGB24.h
    CameraImage_RGB32.cpp
    CameraImage_RGB32.h
    PixelFormatConvert.cpp
    PixelFormatConvert.h
    ToolBarCamera.cpp
    ToolBarCamera.h
    VideoFrame.h
    VideoFrame.cpp
    res/res.qrc
    CameraLoader.h
    CameraLoader.cpp
    CameraFinder.cpp
    CameraFinder.h
)

#set(CMAKE_MODULE_PATH "C:/vcpkg/installed/x64-windows/share/ffmpeg")
find_package(FFmpeg REQUIRED)
target_include_directories(CameraCommon PUBLIC ${FFMPEG_INCLUDE_DIRS})
target_link_directories(CameraCommon PUBLIC ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(CameraCommon PUBLIC ${FFMPEG_LIBRARIES})

target_link_libraries(CameraCommon PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)
target_include_directories(CameraCommon PUBLIC ${PROJECT_SOURCE_DIR}/..)

target_compile_definitions(CameraCommon PRIVATE CAMERA_LIBRARY)

